ans = 0
for x in range(2,10*9**5):
    sum_1 = 0
    for i in str(x):
        sum_1 += int(i)**5
    if sum_1 == x:
        ans+=sum_1
print(ans)

ans = []
for i in range(100,6*9**5):
    if sum(n**5 for n in map(int,list(str(i)))) == i:
        ans.append(i)

print(sum(ans),ans)

